<?php
defined('JOC') or die;
/**
 * Description of __autoload
 *
 * @author javier.camelis
 */

function __autoload($classname)
{
  $classname = strtolower($classname) ;
  
  //try to include DBTable Classes
  if (file_exists(ROOT.'/core/model/'.$classname.'.class.php'))
  {
    require_once(ROOT.'/core/model/'.$classname.'.class.php') ;
  }
  //try to include Modules Classes
  else if (file_exists(ROOT.'/core/module/'.$classname.'.class.php'))
  {
    require_once(ROOT.'/core/module/'.$classname.'.class.php') ;
  }
  //try to include Common Functions Classes
  else if (file_exists(ROOT.'/core/function/'.$classname.'.class.php'))
  {
    require_once(ROOT.'/core/function/'.$classname.'.class.php') ;
  }
  //try to include Render Classes
  else if (file_exists(ROOT.'/core/render/'.$classname.'.class.php'))
  {
    require_once(ROOT.'/core/render/'.$classname.'.class.php') ;
  }
}